package com.lv.base.base.notification;

import android.view.Gravity;

/**
 * 作者：created by albert on 2018/9/28 11:00
 * 邮箱：lvzhongdi@icloud.com
 *
 * @param
 **/
public class Configuration {

    public static final int ANIM_DURATION = 700;

    public static final int ANIM_DISPLAY_DURATION = 1500;

    final long animDuration;

    final long dispalyDuration;

    final String textColor;

    final String backgroundColor;

    final int viewHeight;

    final String iconBackgroundColor;

    final int textGravity;

    final int textLines;

    final int textPadding;

    private Configuration(final Builder builder) {
        this.animDuration = builder.animDuration;
        this.textColor = builder.textColor;
        this.dispalyDuration = builder.dispalyDuration;
        this.backgroundColor = builder.backgroundColor;
        this.textPadding = builder.textPadding;
        this.viewHeight = builder.viewHeight;
        this.iconBackgroundColor = builder.iconBackgroundColor;
        this.textGravity = builder.textGravity;
        this.textLines = builder.textLines;
    }

    public static class Builder {

        private long animDuration;

        private long dispalyDuration;

        private String textColor;

        private String backgroundColor;

        private int textPadding;

        private int viewHeight;

        private String iconBackgroundColor;

        private int textGravity;

        private int textLines;

        public Builder() {
            animDuration = ANIM_DURATION;
            dispalyDuration = ANIM_DISPLAY_DURATION;
            textColor = "#FF444444";
            backgroundColor = "#FFBDC3C7";
            textPadding = 5;
            viewHeight = 48;
            iconBackgroundColor = "#FFFFFFFF";
            textGravity = Gravity.CENTER;
            textLines = 2;
        }

        public Builder(final Configuration baseStyle) {
            animDuration = baseStyle.animDuration;
            textColor = baseStyle.textColor;
            backgroundColor = baseStyle.backgroundColor;
            textPadding = baseStyle.textPadding;
            viewHeight = baseStyle.viewHeight;
            iconBackgroundColor = baseStyle.iconBackgroundColor;
            textGravity = baseStyle.textGravity;
            textLines = baseStyle.textLines;
        }


        public Builder setAnimDuration(long animDuration) {
            this.animDuration = animDuration;
            return this;
        }

        public Builder setDispalyDuration(long dispalyDuration) {
            this.dispalyDuration = dispalyDuration;
            return this;
        }

        public Builder setTextColor(String textColor) {
            this.textColor = textColor;
            return this;
        }

        public Builder setBackgroundColor(String backgroundColor) {
            this.backgroundColor = backgroundColor;
            return this;
        }

        public Builder setTextPadding(int textPadding) {
            this.textPadding = textPadding;
            return this;
        }

        public Builder setViewHeight(int viewHeight) {
            this.viewHeight = viewHeight;
            return this;
        }

        public Builder setIconBackgroundColor(String iconBackgroundColor) {
            this.iconBackgroundColor = iconBackgroundColor;
            return this;
        }

        public Builder setTextGravity(int textGravity) {
            this.textGravity = textGravity;
            return this;
        }

        public Builder setTextLines(int textLines) {
            this.textLines = textLines;
            return this;
        }

        public Configuration build() {
            return new Configuration(this);
        }
    }

}
